hp2xx [-options] [hpgl-file(s)]
Option Format Default Description ------------------------------------------------------------------------- General options: -f char * "" Name of output file (default: stdout) -m char * pcl Mode. Valid: mf,eps, pcl,pcx,pic,img, pre -p char * 11111111 Pensize(s) [dots] (default), [1/10 mm] (mf, ps). Valid: 1 to 8 digits of 0-9 each. -q off Quiet mode. No diagnostic output. -r double 0.0 Rotation angle [deg]. -r90 gives landscape -s char * hp2xx.swp Name of swap file Size controls: -a double 1.0 Aspect factor. Valid: > 0.0 -h double 100 Height [mm] of picture -w double - Width [mm] of picture. If given, overrides -h -x double - Preset xmin value of HPGL coordinate range -X double - Preset xmax value of HPGL coordinate range -y double - Preset ymin value of HPGL coordinate range -Y double - Preset ymax value of HPGL coordinate range Raster format controls: -d int 75 DPI value (x or both x&y) -D int 75 DPI value (y only) PCL only: -F off Send a FormFeed after graphics data -i off Pre-initialize printer -S off Use (Deskjet) Special commands -d (see above) Valid ONLY 300, 150, 100, 75 -D (see above) INVALID for PCL! EPS, PCL, and previews: -o double 0.0 x offset [mm] of picture (left margin) -O double 0.0 y offset [mm] of picture (upper margin) Preview on PC's: -V int 18 VGA mode byte (decimal) ------------------------------------------------------------------------- -H Show help.
hp2xx reads HPGL ASCII source files, interprets them, and converts them into either another vector-oriented format or one of several rasterfile formats. Currently, its HPGL parser only recognizes a small subset of the HP 7475 command subset, basically the absolute or relative Move or Draw commands, so don't expect fancier stuff like circles / text output / filled polygons. Since it only processes simple vectors, its output can be easily adapted to many formats.
hp2xx reads from stdin or from a file if any given on the command line. The output is written to stdout by default. Use option -f outfile to specify your output file name, or just use output redirection (DOS users beware: DOS limits output redirection to ASCII data only, so -f is preferred). The program scans the current HPGL source, writes all vectors in internal binary format into a temporary file, and concurrently determines the maximal coordinate range. It then processes the vectors by mapping them into a new coordinate system with a height of 100mm by default exactly covering the detected y range, and by preserving the aspect ratio of the original data. Use option -h height to set the desired height of your output picture; optionally use -a aspectfactor to alter the aspect ratio by the given factor (aspectfactor < 1 narrows your picture). Alternatively, specify the desired picture width using -w width. The height will then be automatically generated, as will be the width if you control the picture's heigth. Please note that -w overrides any -h option!
Option -r rotation_angle (in degrees) allows you to rotate the object prior to all scaling operations. Its main use is to facilitate landscape format: -r90 rotates your whole picture, e.g. from portait to landscape format. However, any reasonable rotation angle is valid.
If you need to process a series of similar objects which should be translated into exactly the same coordinate system, there is a way to override the auto-scaling: First, run all files separately and note the infos on the used coordinate ranges. Then, pick a range that will cover ALL your pictures. You can now assign defaults to the internally generated range limits by specifying -x xmin, -X xmax, -y ymin, and -Y ymax. NOTE: Clipping is NOT supported! If any picture coordinate exceeds your limits, they will be overwritten.
Use option -m mode to select the program mode, i.e. the output format. Currently supported: mode = "mf" (Metafont), "eps" (PostScript), "pcl" (HP-PCL Level 3 format, suitable for printing on a HP Laserjet II, DeskJet, or compatible printer), "img" (GEMs IMG format), "pic" (ATARI ST bitmap), or "pcx" (PC-Paintbrush format, also accepted by MS-Paintbrush / Windows 3.0 and many other PC based pixel renderers). There is also a preview option "pre" which supports VGA cards (DOS), ATARI, X11 servers, and Sunview. Default mode is pcl.
If you use a raster format, the picture is rasterized by default into a 75 DPI resolution image. Use option -d DPI_value to change the resolution, e.g. -d300 will cause a HP LJ-II compatible 300 dpi rasterization. There is a way of specifying a different resolution for y direction: -D DPI_y_value, although it is of limited use yet. It is intended for, e.g., support of NEC P6 printers (360x180 DPI) and alike in a later release. In preview mode, -d72 -D72 is assumed.
If processing large pictures at high resolution on low-memory machines, typically under DOS, the program may start swapping. Optionally change the swap file by using -s swapfile, e.g. to speed up processing by swapping to a RAM disk.
A carusel of 8 pens is simulated. You can specify pen sizes for each of these pens via option -p string. "string" must consist of 1..8 digits (0-9). Digit number n (counting from left) corresponds to pen number n. The digit value is this pen's size in internal units. For raster formats, a unit is a pixel, and for vector format, it corresponds to 1/10 mm (see below). The default size is 1 for all pens. Examples of use: -p22222222 changes all pensizes to 2, -p302 gives pen #1 a size of 3, pen #3 a size of 2, suppresses all drawing with pen #2, and keeps all other pen sizes.
Currently, two vector formats are supported: TeX/Metafont and -I PostScript. Use -m mf to convert a HPGL drawing into a Metafont character to be included into a TeX document as the character "Z" of a special font that you may create. Edit the metafont source, e.g., to change the letter "Z" for another, or to change the line thickness, which is set to 0.4pt by default. Use option -p pensize(s) for control over pensize: The actual Metafont or PostScript pensize will be "pensize * 0.1 mm", with pensize = 0 - 9 (0 = no drawing). The same applies to In PostScript mode (-m eps), you also need to use options -o and -O (see below) for proper margins in paper since hp2xx puts your picture "flush" to the left and upper paper limit by default.
The following formats are supported: HP-PCL, PCX, PIC, IMG, and previews. However, generation of other formats is made easy for programmers because of hp2xx's modular structure. The program allocates a bitmap on a line-by-line basis, swapping lines to disk if needed, and plots into this bitmap. Depending on the selected format, a conversion module is then activated, which might easily be replaced by other converters. Add more formats if you like!
Option -p pensize(s) controls the size (in pixels) of the virtual plotting pen. The only implemented shape of the pen tip is a square of the given length. pen sizes of 5...9 units will be acccepted but replaced by 4 units. Specifying -p4 when in 75 DPI mode will make pretty clumsy pictures, while you may prefer -p2 over -p1 when in 300 DPI.
PCX: The size of a PCX picture is controlled via its specified height and the current DPI value. To create a high-resolution PCX image, just increase the DPI value as desired. PCX format does not accept offsets.
IMG: See PCX.
PIC: ATARI ST screens (640x400 pixels) can easily be dumped to files, Programs such as STAD accept graphics by including screen dump files. Graphics filling more than one screenful may be split into screen-size blocks and loaded/mounted blockwise. hp2xx converts to ATARI bitmap format by trying to fit the resulting picture into a single screen equivalent (max. 400 rows, max. 80 Bytes (640 pixel) per row). If it succeeds, hp2xx produces a single output file. Specify ONLY its base name (option -f), since hp2xx adds the file extension ".pic" automatically. Do NOT use more than 6 characters for the file name, and avoid digits. If more screen blocks are required horizontally and/or vertically, hp2xx will automatically split the picture into separate files, counting them columnwise (top-to-bottom and left-to-right), adding a two-digit number to the given file name. A maximum of 10 columns is supported. The picture is padded with background color at its right and lower margins, if needed. File compression is not supported (use a separate utility instead).
By setting DPI and height/width, you implicitely have control over the resulting scan lines or columns. E.g., leaving DPI at its default (-d 75), and specifying a height of 135mm (-h 135), you'll get 400 rows.
PCL: HP-PCL Level 3 format, most useful for direct printer output. Due to this action, there have been added some extra flags and options: Use flag -i to send a printer initialization sequence before the actual image. Flag -F adds a Form Feed (FF, hex 0C) after the image is completed, which is what you may want most of the time. However, overlay printing of several files is feasible by omitting -F.
For additional control of the picture's final position on paper, you may add x or y offsets using -o X_offset or -O Y_offset. E.g., -o 20 -O 30 will give you 30 mm additional top margin and 20 mm additional left margin.
For DeskJet / DeskJet-plus / DeskJet 500 printers, there are some special printer commands. Activate them with flag -S.
PRE: Preview on all machines assumes 72 DPI even if your actual screen may differ from that. Use options -h -w -o -O to define the screen size and position of your output. For VGA cards (DOS), option -V VGAmode gives you a simple way to utilize hi-res Super-VGA graphics. Please take care not to define larger windows than your graphics device can handle, as the results are unpredictable.
% hp2xx -m pcx -f my_output.pcx -d300 -p2222 -h50 -a 1.2 my_input.hp creates a PCX file at 300 DPI of height 50 mm, using an aspect factor of 1.2 and a pen size of 2 pixels for pens 1-4. % my_hpgl_generator | hp2xx -o20 -O30 -F -q | lpr -P my_PCL_printer HPGL output is piped through hp2xx; the resulting PCL code is piped to the printer queue, giving an image of height 100 mm at 75 DPI. An additional left margin of 20mm and upper margin of 30mm is created. A formfeed will be added (handy if your printer queue does not). % hp2xx -m pre my_input.hp Preview on screen or into window.
Heinz W. Werntges, Biokybernetik, Geb. 26.12, Heinrich-Heine-Universitaet, D-4000 Duesseldorf 1, Germany. Internet: heinz@biokyb.uni-duesseldorf.de ATARI features and img mode are due to Norbert Meyer, Duesseldorf.
The number of ignored and/or unknown HPGL commands is given. You will be informed if swapping starts. Progress is indicated by output of dots, each dot representing 10 move/draw commands during scanning and plotting, or 10 scan lines during output. Shut off diagnostic output by specifying -q (quiet mode).